﻿using System.Data.Entity.ModelConfiguration;

using NeGroid.ChampionshipManager.Core;

namespace NeGroid.ChampionshipManager.Persistance.Mappings
{
	class GameMap : EntityTypeConfiguration<Game>
	{
		public GameMap()
		{
			HasKey(t => t.Id);

			HasRequired(t => t.TeamHome)
				.WithMany()
				.HasForeignKey(t => t.TeamHomeId)
				.WillCascadeOnDelete(false);
			HasRequired(t => t.TeamGuest)
				.WithMany()
				.HasForeignKey(t => t.TeamGuestId)
				.WillCascadeOnDelete(false);

			ToTable("Games");
		}
	}
}
